package com.nbpt;

import android.content.Intent;
import android.os.CountDownTimer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class WelcomeActivity extends AppCompatActivity {
    private TextView wel1,wel2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        Init();
    }
    public void Init()
    {
        wel1=findViewById(R.id.wel1);
        wel2=findViewById(R.id.wel2);
    }
    CountDownTimer countDownTimer=new CountDownTimer(3000,1000) {
        @Override
        public void onTick(long l) {
            wel1.setText(l/1000+"秒");
        }

        @Override
        public void onFinish() {
            Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
            startActivity(intent);
            finish();
        }

    }.start();

    public void wel(View view) {
        Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
        startActivity(intent);
        countDownTimer.cancel();
        finish();
    }

}
